<template>

<el-form ref="dataFormRef" :model="dataForm" label-width="120px">
	<el-form-item prop="pipelineName" label="流水线名称" 
						:rules="{
							required: true,
							message: '流水线名称不能为空',
							trigger: 'blur',}"
	>
	 <el-input v-model="dataForm.pipelineName" placeholder="流水线名称" style="width:250px"></el-input>
    </el-form-item>

    <el-form-item prop="pipelineBranch" label="代码分支" 
						:rules="{
							required: true,
							message: '分支不能为空',
							trigger: 'blur',}"
	>
	 <el-input v-model="dataForm.pipelineBranch" placeholder="请输入代码分支" style="width:250px"></el-input>
    </el-form-item>

    <el-form-item prop="workSpace" label="工作空间目录" 
						:rules="{
							required: true,
							message: '工作空间目录不能为空',
							trigger: 'blur',}"
	>
	 <el-input v-model="dataForm.workSpace" placeholder="请输入流水线工作空间目录" style="width:250px"></el-input>
    </el-form-item>
	
</el-form>
</template>
<script setup lang="ts">

import { onMounted, reactive, ref } from 'vue'


const dataFormRef = ref()

const dataForm = reactive({
	pipelineName: '',
	enable:1,
    pipelineBranch:'',
    workSpace:'',
    isValid:false
})

onMounted(() =>{
    props.basePipelineInfo.formData = dataForm
})

const validData = async () => {
 await  dataFormRef.value.validate((valid: boolean) => {
        if(!valid){
            dataForm.isValid = false
        }else{
            dataForm.isValid = true
        }
    })
    return dataForm.isValid
}

const props = defineProps({
    basePipelineInfo: Object as any,
});

defineExpose({
	validData
})

</script>